package chapter10;

public class B {
	private final int size=10;
	private U []array=new U[size];
	private int index=0;
	public void addU(U u)
	{
		if(index!=size)
			array[index++]=u;
		else
			System.out.println("Operation Wrong");
	}
	public U getU(int i)
	{
		if(i>index)
		{
			System.out.println("Out of range");
			return null;
		}
		else
		{
			return array[i];
		}
	}
	public void clear()
	{
		int i=0;
		while(i!=index)
			array[i]=null;
	}
	public void traverse()
	{
		int i=0;
		while(i!=index)
			System.out.println(array[i]);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
